package pokerantani.v2.linematchers;

import java.util.regex.Pattern;

import pokerantani.v2.LineMatcher;
import pokerantani.v2.RE;


public class ActCall extends LineMatcher {
	static final Pattern pActCall = Pattern.compile("(" + RE.PLAYER + "):? calls \\$?(" + RE.FLOAT + ")");
	static final Pattern pActCallAllIn = Pattern.compile("(" + RE.PLAYER + "):? calls \\$?(" + RE.FLOAT + "),? and is all[\\- ]in");
	
	public String playerName;
	public float amount;
	public boolean allin;
	
	public boolean match(String line) {
		if(match(line, pActCall)) {
			playerName = group(1);
			amount = groupFloat(2);
			allin = false;
			return true;
		}
		if(match(line, pActCallAllIn)) {
			playerName = group(1);
			amount = groupFloat(2);
			allin = true;
			return true;
		}
		return false;
	}
}
